﻿
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
using Model;
using MsDAL;
using System.ComponentModel;

namespace ServiceHelper
{
    [DataObjectAttribute]
    public partial class Sto1a00Manager : Sto1a00Base
    {
        private static Sto1a00Manager _entity;

        public static Sto1a00Manager Entity
        {
            get
            {
                if (_entity == null)
                    _entity = new Sto1a00Manager();
                return _entity;
            }
        }

        #region 个人代码
        public string SaveData(Hashtable tb, string action, string usercode)
        {
            List<SqlApp> lst = new List<SqlApp>();

            Sto1a00 model = null;
            if ("A" == action)
            {
                model = new Sto1a00();
                Components.CommonUtil.GetInstance.CopyProperties(tb, model);
                //添加维护者信息
                model.Usercode = Context.GetAppByUserCode(usercode);
                model.Statuscode = 1;

                //生成主键标识
                model.Listid = Sys0a60Manager.Entity.CreateSn("sto1a00_listid", usercode);
                //执行新增
                lst.Add(this.Add(model));
            }
            else if ("M" == action)
            {
                model = this.GetModelById(Components.Validation.ToString(tb["listid"]));

                if (model == null) return string.Format("仓库代码({0})可能已经被删除，请重新操作！",
                    tb["stocode"]);

                Components.CommonUtil.GetInstance.CopyProperties(tb, model);

                lst.Add(this.Update(model));
            }

            return CommonManager.Entity.SaveData(lst);
        }
        #endregion
    }
}



